package com.mes.task.service;


import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.data.provider.Page;
import com.mes.common.service.BasicService;
import com.mes.task.dao.iface.ITaskPartDao;
import com.mes.task.domain.Task;
import com.mes.task.domain.TaskPart;
import com.mes.util.ScheduleUtil;

@Service
public class TaskPartService extends BasicService<Task> {

	@Autowired
	private ITaskPartDao taskPartDao;
	@Resource
	private ScheduleUtil scheduleUtil;
	
	@DataProvider
	public List<Task> getOperationTasksByPartTaskUid(String partTaskUid)
			throws Exception {
//		Task t = taskDao.getById("3534711");
//		String a = t.getBatchNum();
//		System.out.print(a);
////		List<OperationTask> list = operationTaskDao.getOperationTasksByPartTaskUid(partTaskUid, false);
//		List<Task> list = new ArrayList<Task>();
//		Task ot = taskDao.getById("3534711");
//		list.add(ot);
//		return list;
	
	return null;
	}
	
	@DataProvider
	public List<TaskPart> getTaskPartByTaskUid(String taskUid) throws Exception {
		return taskPartDao.getTaskPartByTaskUid(taskUid);
	}
	
	/**
	 * @author lcs
	 * @see 用于AO任务管理界面（AOTaskManger）界面齐套情况tab页面获取数据
	 * @param page
	 * @param parameters
	 * @throws Exception
	 */
	@DataProvider
	public void getTaskPartByTaskUidUsePage(Page<TaskPart> page, Map<String, Object> parameters) throws Exception {
		String taskUid = (String)parameters.get("taskUid");
		List<TaskPart> taskPartList = taskPartDao.getTaskPartByTaskUid(taskUid,page);
		if (taskPartList != null && taskPartList.size()!=0) {
			scheduleUtil.initPage(page, taskPartList);
		}
	}


}
